<?php


namespace App\Transformers\Order;


use App\Models\OrderCartInfo;
use League\Fractal\TransformerAbstract;

class OrderCartInfoTransformer extends TransformerAbstract
{

    public function transform(OrderCartInfo $data)
    {
        return [
            'id' => $data->id,
            'order_id' => $data->order_id ?? '',
            'cart_id' => $data->cart_id ?? '',
            'product_id' => $data->product_id ?? '',
            'unique' => $data->unique ?? '',
            'cart_info' => $data->cart_info ?? [],
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
            'deleted_at' => $data->deleted_at ? $data->deleted_at->format("Y-m-d H:i:s") : '',
        ];
    }



}
